from captcha.fields import CaptchaField
from django import forms

from django.contrib.auth.models import User


class UserForm(forms.Form):
	"""
	登录表单
	"""
	username = forms.CharField(label="账号", max_length=16, widget=forms.TextInput(attrs={'class': 'form-control'}))
	password = forms.CharField(label="密码", max_length=16, widget=forms.PasswordInput(attrs={'class': 'form-control'}))
	captcha = CaptchaField(label='验证码', error_messages={"invalid": u"验证码错误", "required": u"请输入验证码"})


class RegisterForm(forms.Form):
	"""
	注册表单
	"""
	username = forms.CharField(label="账号", max_length=16, widget=forms.TextInput(attrs={'class': 'form-control'}))
	password1 = forms.CharField(label="密码", max_length=16, widget=forms.PasswordInput(attrs={'class': 'form-control'}))
	password2 = forms.CharField(label="确认密码", max_length=16,
	                            widget=forms.PasswordInput(attrs={'class': 'form-control'}))
	email = forms.EmailField(label="邮箱地址")
	captcha = CaptchaField(label='验证码', error_messages={"invalid": u"验证码错误", "required": u"请输入验证码"})